import { reqUserAddressList, reqTradeInfo } from "@/api";
export default {
  state: {
    userAddressList: [],
    tradeInfo: {},
  },
  mutations: {
    UPDATE_USERADDRESSLIST(state, userAddressList) {
      state.userAddressList = userAddressList;
    },
    UPDATE_TRADEINFO(state, tradeInfo) {
      state.tradeInfo = tradeInfo;
    },
  },
  actions: {
    async getUserAddressList({ commit }) {
      const res = await reqUserAddressList();
      if (res.code === 200) {
        commit("UPDATE_USERADDRESSLIST", res.data);
      }
    },
    async getTradeInfo({ commit }) {
      const res = await reqTradeInfo();
      if (res.code === 200) {
        commit("UPDATE_TRADEINFO", res.data);
      }
    },
  },
  getters: {},
};
